//
//  LocalInfoUtil.m
//  PywSdk
//
//  Created by zhj on 2018/8/16.
//  Copyright © 2018年 zhj. All rights reserved.
//  本地数据缓存
//
//

#import "LocalInfoUtil.h"

@implementation LocalInfoUtil

static NSString* const KEY = @"pyw_anoun_status";

// 存入消息的标志状态
// true-不再提示
+(void) saveMsgStatus:(BOOL) sta withMsgId:(int32_t)msgid{
    int32_t ret = sta?1:0;
    ret <<= 31;
    ret |= msgid;
    NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
    NSString *result = [NSString stringWithFormat:@"%d",ret];
    [defaults setObject:result forKey:KEY];
}


// 获取消息是否标志为不再提示
// true-不再提示
+(BOOL) getMsgStatus:(int32_t)msgId{
    NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
    NSString *rStr = [defaults valueForKey:KEY];
    int32_t ret = [rStr intValue];
    int32_t compare = 1;
    compare <<= 31;
    compare |= msgId;
    return compare==ret;
}


@end
